#include <stdio.h>

int sqrt(int x) {
	// Start typing your C/C++ solution below
	// DO NOT write int main() function
	if(x==1)
		return 1;
	unsigned int left = 1;
	unsigned int maxnum = 0x1 << 16;
	unsigned int right = maxnum > x? x : maxnum;
	while(left<right-1){
		unsigned int mid = (left+right)/2;
		if(mid * mid > x){
			right = mid;
		}
		else if(mid * mid < x){
			left = mid;
		}
		else if(mid * mid == x){
			return mid;
		}
	}
	return left;

}

int main(){


	printf("%d\n",sqrt(2147395599));
	return 0;
}